package mytaxis.move.model;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class MyTaxisDB extends SQLiteOpenHelper {

	String createTasca = "CREATE TABLE Tasca (_id INTEGER PRIMARY KEY AUTOINCREMENT, datahora INTEGER, "
			+ "datahorastring TEXT, estat TEXT, ubicacio TEXT, longitud REAL, latitud REAL)";
	String createTascaPendent = "CREATE TABLE TascaPendent (_id INTEGER PRIMARY KEY AUTOINCREMENT, "
			+ "datahorastring TEXT, ubicacio TEXT, longitud REAL, latitud REAL, datarebut INTEGER)";

	public MyTaxisDB(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(createTasca);
		db.execSQL(createTascaPendent);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldversion, int newversion) {
		db.execSQL("DROP TABLE *");
		db.execSQL(createTasca);
		db.execSQL(createTascaPendent);
	}

}
